import chardet

# print(cr.input_type("1"))
#调用测试
#while 1:
    # a=input("input num:\n")
    # b=ComRe.input_type(a)
# a=(1,2,3,4,5,6,7)
# b=[3,4,5]
# c=ComRe.to_dict(a,b,7)
# print(c)
                # #参数顺序：必选参数、默认参数、可变参数、命名关键字参数、关键字参数
# def f1(a, b, c=0, *args, **kw):
#     print('a =', a, 'b =', b, 'c =', c, 'args =', args, 'kw =', kw)
# def f2(a, b, c=0, *ds,d,**kw):
#     print('a =', a, 'b =', b, 'c =', c,'ds=',ds, 'd =', d, 'kw =', kw)
# argsa = (1, 2, 3, 4,5,6)
# kws = {'d': 99, 'x': '#'}
# f2(*argsa, **kws)
                #切片测试
# s1=list(range(21))
# print(s1[::5])
# print(s1[-4:])
# print(s1[0:11])
# print(tuple(range(3)))
                #迭代、、循环
# d = {'a': 1, 'b': 2, 'c': 3}        #字典
# for k in d.values():              #显示value
#     print(k)
# for k,v in d.items():             #显示key=>value
#     print(k,"=>",v)
# print("is Iterable ",isinstance([],Iterable)) #Iterable 判断是否可迭代
# print("is Iterator ",isinstance([],Iterator)) #Iterator 判断是否为迭代器（可调用next()） 可以用iter()进行转化
# for i,v in enumerate(d):          #列举下标
#     print(i,v)
                #列表生成式
#print([str(x*x)+y for x in range(6) for y in 'ABCDEFGHIJ'])
#d = {'x': 'A', 'y': 'B', 'z': 'C' }
#print([k+"="+v for k,v in d.items()])
# d=['Hello', 'World', 'IBM', 'Apple']
# print([s.upper() for s in d])   #lower 转小写 upper 转大写 title 单词首字母大写
# L = ['Hello', 'World', 18, 'Apple', None]
# print([s.lower() for s in L if isinstance(L,Iterable) and isinstance(s,str)])
                #生成器 generator
# g=(x*x for x in range(11))
# for s in g:
#     print(s)
            #斐波拉契数列
# def fi(num):
#     n,a,b=0,0,1
#     while n<num:
#         n+=1
#         print("step ",n)
#         yield(b)
#         a,b=b,a+b
# for x in fi(20):
#     print(x)
            #杨辉三角
# def triangles(n):
#     L = [1]
#     while len(L) <= n:
#         yield L
#         L.append(0)#末尾添加0元素
#         L = [L[i-1] + L[i] for i in range(len(L))]#生成新的列表 值为上一个列表的两两之和 L[-1]为末尾元素0
# for x in triangles(int(input("nums:"))):
#     print(x)
                #获取当前目录下文件名
# print([x for x in os.listdir()])
                #格式化输出时间
# a=time.time()
# b1=cr.my_time(type=0)
# b2=cr.my_time(a,type=1)
# b3=cr.my_time(a,type=2)
# b4=cr.my_time(type=2)
# print("b1=",b1,"b2=",b2,"b3=",b3,"b4=",b4)
                #高阶函数   函数作为变量传入sw
# def add(a,b,f):
#     return f(a)*f(b)
# print(add(-99,20,abs))
                #map(function,Iterable) //每次传入迭代的下一个值，函数内部接受到的是单独的值   不需要进行分割等操作
                #reduce(函数名，可迭代参数)
# L1 = ['adam', 'LISA', 'barT']
# def user_name(d):
#     return d.title()
# print(list(map(user_name,L1)))
# print(ComRe.str2float("123.456"))
# def all_list():
#     n=1
#     while True:
#         n=n+2
#         yield n
# def filet(n):
#     return lambda x:x%n>0
# def pri():
#     yield 2
#     it=all_list()
#     while True:
#         n=next(it)
#         yield n
#         it=filter(filet(n),it)
# for n in pri():
#     if n<500:
#         print(n)
#     else:
#         break
# 传递引用
# def test(a):
#     print(id(a))
#     #a =a+ a  #不修改源
#     a +=a     #修改源
#     print(id(a))
#     print(a)
# a=[1,2]
# print(id(a))
# while len(a)<20:
#     test(a)
# print(a)
# 利用types判断类型
#print("1") if types.FunctionType==type(test) else print("2")